#!/bin/bash

user=$(echo $USER)
echo "当前登录用户为${user}"
currentDir=$(cd $(dirname $0); pwd)
. ${currentDir}/config.sh


#创建dev开发工具目录 /home/${user}/dev
if [ ! -d /home/${user}/dev ]; then
    mkdir -p /home/${user}/dev
fi

#创建项目目录 mkdir -p /home/${user}/project
if [ ! -d /home/${user}/project ]; then
    mkdir -p /home/${user}/project
fi

#创建环境变量文件
if [ ! -f /home/${user}/.bash_path ]; then
    touch /home/${user}/.bash_path
    implortEnv=$(cat /home/${user}/.bashrc | grep .bash_path)
    if [ ! $? -eq 0 ]; then
        echo "
if [ -f ~/.bash_path ]; then
    . ~/.bash_path
fi
" >>/home/${user}/.bashrc
        source /home/${user}/.bashrc
    fi
fi
. /home/${user}/.bash_path

menu="
可操作项\n
menu 重新显示可操作项\n
-1退出脚本\n
1 安装jdk&maven\n
2 安装Docker\n
3 安装go\n
4 安装php&apache2\n
5 安装postman\n
6 安装Dbeaveree\n
7 安装桌面软件\n
8 docker启动mysql\n
请输入一个操作值:
"
/bin/echo -e ${menu}
while :; do
    /bin/echo -e "输入menu重新显示可操作项\n请输入操作值："
    read num
    case $num in
    "menu")
        /bin/echo -e ${menu}
        ;;
    -1)
        exit 0
        ;;
    1)
        . ${currentDir}/dev/installJava.sh
        ;;
    2)
        . ${currentDir}/dev/installDocker.sh
        ;;
    3)
        . ${currentDir}/dev/installGo.sh
        ;;
    4)
        . ${currentDir}/dev/installPHPAndApache2.sh
        ;;
    5)
        . ${currentDir}/devsoft/installPostman.sh
        ;;
    6)
        . ${currentDir}/devsoft/installDbeaveree.sh
        ;;
    7)
        . ${currentDir}/sys/installDeskTool.sh
        ;;
    8)
        . ${currentDir}/dev/installMysql.sh
        ;;
    esac
done